/**
 * 神州信息(2012)
 */
package net.abbp.report.model;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

/**
 * Cell列表,自动排序
 * 
 * @version 1.0
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ABBP 1.0
 * 
 *        <pre>
 * 历史：
 *      建立: 2012-7-20 lexloo
 * </pre>
 */
class CellList implements List<Cell> {
    // 单元格对象代理
    private List<Cell> delegate = new ArrayList<Cell>();

    public CellList() {
    }

    @Override
    public void add(int index, Cell cell) {
        throw new UnsupportedOperationException("不支持的操作");
    }

    @Override
    public boolean add(Cell cell) {
        for (int i = 0, size = delegate.size(); i < size; i++) {
            if (cell.compareTo(delegate.get(i)) < 0) {
                delegate.add(i, cell);

                return true;
            }
        }

        delegate.add(cell);
        return true;
    }

    public boolean addAll(Collection<? extends Cell> c) {
        throw new UnsupportedOperationException("不支持的操作");
    }

    public boolean addAll(int index, Collection<? extends Cell> c) {
        throw new UnsupportedOperationException("不支持的操作");
    }

    public void clear() {
        delegate.clear();
    }

    public boolean contains(Object o) {
        return delegate.contains(o);
    }

    public boolean containsAll(Collection<?> c) {
        throw new UnsupportedOperationException("不支持的操作");
    }

    public boolean equals(Cell o) {
        return delegate.equals(o);
    }

    public Cell get(int index) {
        return delegate.get(index);
    }

    public int hashCode() {
        return delegate.hashCode();
    }

    public int indexOf(Object o) {
        return delegate.indexOf(o);
    }

    public boolean isEmpty() {
        return delegate.isEmpty();
    }

    public Iterator<Cell> iterator() {
        return delegate.iterator();
    }

    public int lastIndexOf(Object o) {
        return delegate.lastIndexOf(o);
    }

    public ListIterator<Cell> listIterator() {
        return delegate.listIterator();
    }

    public ListIterator<Cell> listIterator(int index) {
        return delegate.listIterator(index);
    }

    public Cell remove(int index) {
        return delegate.remove(index);
    }

    public boolean remove(Object o) {
        return delegate.remove(o);
    }

    public boolean removeAll(Collection<?> c) {
        return delegate.removeAll(c);
    }

    public boolean retainAll(Collection<?> c) {
        throw new UnsupportedOperationException("不支持的操作");
    }

    public Cell set(int index, Cell cell) {
        throw new UnsupportedOperationException("不支持的操作");
    }

    public int size() {
        return delegate.size();
    }

    public List<Cell> subList(int fromIndex, int toIndex) {
        throw new UnsupportedOperationException("不支持的操作");
    }

    public Object[] toArray() {
        return delegate.toArray();
    }

    @Override
    public <T> T[] toArray(T[] a) {
        return delegate.toArray(a);
    }
}
